# -*- coding: utf-8 -*-
from pipe.readExcel import readExcel, exportExcel


def SelectHeight(path,selectField1,selectField2,value,excelName):
    '''高程筛选'''
    df=readExcel(path)
    # df['res'] = df.duplicated(duplicateFields, keep='last')
    # todo：选择的df，默认不改变原来的df
    df2=df[(df[selectField1]>value)| (df[selectField2]>value) ]
    # df[df[selectField1]>=value]

    exportExcel(path,df2,excelName)


def SelectHeightIsIn(path,selectField1,slectvalues,excelName):
    '''高程筛选'''
    df=readExcel(path)
    # df['res'] = df.duplicated(duplicateFields, keep='last')
    # todo：选择的df，默认不改变原来的df
    df2=df.loc[df[selectField1].isin(slectvalues)]
    # df[df[selectField1]>=value]

    exportExcel(path,df2,excelName)

if __name__ == '__main__':
    # selectField1='S_H'
    # selectField2='E_H'
    # value=700
    # excelName="高程检查"
    # path=r"E:\data\qingyang\qingyangmdb\result\6.2023.02.19处理\管线数据处理\7-后半部分【结果】不重复-管线调查表.xlsx"
    # SelectHeight(path,selectField1,selectField2,value,excelName)

    slectvalues=['0075HYS0092','0110HWS1012',
'0886HWS0067',
'1130HWS0028',
'1130HWS0030',
'1154HYS0066',
'1171HWS0019',
'1172HYS0004',
'1651HWS0201',
'1833HYS0100',
'1833HYS0101',
'1833HYS0102',
'2023HWS0035',
'2115HYS0667',
'2448HYS0965',
'2453HYS0244',
'2471HWS0015',
'2635HYS0027',
'35532YS1798',
'27752WS1610',
'0886HWS0063',
'1130HWS0030',
'1130HWS0031',
'1154HYS0065',
'1171HWS0018',
'37018YS0126',
'1651HWS0003',
'1833HYS0103',
'1833HYS0100',
'1833HYS0100',
'2023HWS0033',
'2115HYS0668',
'2448HYS0961',
'2453HYS0247',
'423320WS2211',
'2635HYS0026']
    selectField1 = 'EXP_NO'
    excelName="筛选点号"
    path = r"E:\data\qingyang\qingyangmdb\result\6.2023.02.19处理\管点数据处理\3.管点重复-管点调查表转换坐标2023-02-25-15-34-38.xlsx"
    SelectHeightIsIn(path,selectField1,slectvalues,excelName)
